def is_prime(n):
    if n < 2:
        return False
        for i in range(2,int(n**0.5)+ 1):
            if n % i == 0:
                return False
                return True
        
                def max_prime(num):
                    if len(str(num)) != 4:
                        return 0
                
                        digits = list(str(num))
                        primes = []
                
                        for i in range(4):
                            for j in range(i+1,4):
                                current_num = int(digits[i] +
                                digits[j])
                                if is_prime(current_num):
                                    primes.append(current_num)
                                
                                    if len(primes) == 0:
                                        return 0
                                    else:
                                        return max(prime)
                                        
                                        num = int(input("Введите 4-х значное число"))
                                        print(max_prime(num))
                                        
                                        
                            